home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / focusprb / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  2.2 KB  |  91 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5070
  5.    ClientLeft      =   1425
  6.    ClientTop       =   1725
  7.    ClientWidth     =   6780
  8.    Height          =   5475
  9.    Left            =   1365
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5070
  12.    ScaleWidth      =   6780
  13.    Top             =   1380
  14.    Width           =   6900
  15.    Begin TextBox Text3 
  16.       Height          =   495
  17.       Left            =   4200
  18.       TabIndex        =   2
  19.       Text            =   "Text3"
  20.       Top             =   1440
  21.       Width           =   1215
  22.    End
  23.    Begin TextBox Text2 
  24.       Height          =   495
  25.       Left            =   2760
  26.       TabIndex        =   1
  27.       Text            =   "Text2"
  28.       Top             =   960
  29.       Width           =   1215
  30.    End
  31.    Begin TextBox Text1 
  32.       Height          =   495
  33.       Left            =   1320
  34.       TabIndex        =   0
  35.       Text            =   "Text1"
  36.       Top             =   480
  37.       Width           =   1215
  38.    End
  39.    Dim LastControl As Control
  40.    Dim CurrControl As Control
  41. Sub CheckLostFocus ()
  42.     If (LastControl.Tag = "True") Then
  43.         X% = MsgBox("Is the value OK ?", 36, LastControl + " has Lost Focus")
  44.         If X% = 6 Then    'if YES
  45.             LastControl.Tag = ""
  46.             CurrControl.SetFocus
  47.         Else
  48.             LastControl.SetFocus
  49.         End If
  50.     End If
  51. End Sub
  52. Sub Form_Load ()
  53.     Set LastControl = Text1
  54. End Sub
  55. Sub Text1_Change ()
  56.     Text1.Tag = "True"
  57. End Sub
  58. Sub Text1_GotFocus ()
  59.     Set CurrControl = Text1
  60.     CheckLostFocus
  61. End Sub
  62. Sub Text1_KeyPress (KeyAscii As Integer)
  63.     If KeyAscii = 13 Then
  64.         KeyAscii = 0
  65.         Text2.SetFocus
  66.     End If
  67. End Sub
  68. Sub Text1_LostFocus ()
  69.     Set LastControl = Text1
  70. End Sub
  71. Sub Text2_Change ()
  72.     Text2.Tag = "True"
  73. End Sub
  74. Sub Text2_GotFocus ()
  75.     Set CurrControl = Text2
  76.     CheckLostFocus
  77. End Sub
  78. Sub Text2_LostFocus ()
  79.     Set LastControl = Text2
  80. End Sub
  81. Sub Text3_Change ()
  82.     Text3.Tag = "True"
  83. End Sub
  84. Sub Text3_GotFocus ()
  85.     Set CurrControl = Text3
  86.     CheckLostFocus
  87. End Sub
  88. Sub Text3_LostFocus ()
  89.     Set LastControl = Text3
  90. End Sub
  91.